package com.slofzx.nuoda.evaluation.project.enums;

import com.slofzx.nuoda.common.EnumConfig;
import com.slofzx.nuoda.common.config.Type;

/**
 * 原油分组枚举
 * @author sunfuyong
 */
@EnumConfig(id="oil-group",name = "原油分类")
public enum OilGroupEnum implements Type {
    SHENGLI("shengli","胜利原油",1),
    GUDAO("gudao","孤岛原油",2),
    LINPAN("linpan","临盘原油",3),
    CHUNFENG("chunfeng","春风原油",4),
    SHENGLI_HAISHANG("shengli_haishang","胜利海上",8),
    DONGXINXIAN("dongxinxian","东辛线",6),
    DONGLINXIAN("donglinxian_luning","东临线(鲁宁线)",7);
    /**
     * 数据类型id
     */
    private String id;
    /**
     * 数据类型展示名称
     */
    private String name;
    /**
     * 排序值
     */
    private double sort;

    OilGroupEnum(String id, String name,double sort) {
        this.id = id;
        this.name = name;
        this.sort = sort;
    }

    @Override
    public String getId() {
        return id;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public double getSort() {
        return sort;
    }

    /**
     * 根据id获取对应的枚举
     * @param id 枚举值的标识
     * @return
     */
    public static OilGroupEnum getEnum(String id){
        for(OilGroupEnum dataTypeEnum: OilGroupEnum.values()){
            if(dataTypeEnum.getId().equals(id)){
                return dataTypeEnum;
            }
        }
        return null;
    }
}
